// 教师信息表
const sequelize = require( '../config.js')
const { DataTypes } = require('sequelize')

const student = sequelize.define('student', {
	Id: {
	  type: DataTypes.INTEGER,
	  primaryKey: true,
	  autoIncrement: true,
	},
	student_name: {
	  type: DataTypes.STRING,
	  allowNull: false,
	  comment:'姓名'
	},
	student_sex:{
		type:DataTypes.STRING,
		comment:"性别"
	},
	student_age:{
		type:DataTypes.STRING,
		comment:'年龄'
	},
	student_address:{
		type:DataTypes.STRING,
		comment:'地址'
	},
	student_phone:{
		type:DataTypes.STRING,
		comment:'学生手机号'
	},
	student_school:{
		type:DataTypes.INTEGER,
		comment:'所属院校'
	},
	student_grade:{
		type:DataTypes.INTEGER,
		comment:'年级'
	},
	student_class:{
		type:DataTypes.INTEGER,
		comment:'班级'
	},
	specialty_id:{
		type:DataTypes.INTEGER,
		references:{
			model:'specialties',
			key:'specialty_id'
		},
		comment:'专业'
	},
	student_pic_head:{
		type:DataTypes.STRING,
		comment:'头像'
	},
	student_pic_idcard:{
		type:DataTypes.STRING,
		comment:'学生身份证'
	},
	guardian_phone:{
		type:DataTypes.STRING,
		comment:'监护人手机号'
	},
	guardian_name:{
		type:DataTypes.STRING,
		comment:'监护人姓名'
	}
  },{ timestamps: false});

  const studentManifestation = sequelize.define('student_manifestation', {
	Id: {
	  type: DataTypes.INTEGER,
	  primaryKey: true,
	  autoIncrement: true,
	},
	student_id:{
		type:DataTypes.INTEGER,
		references:{
			model:'students',
			key:'Id'
		},
		comment:'学生id'
	},
	occurrence_time:{
		type:DataTypes.DATE,
		comment:'发生时间',
		defaultValue:DataTypes.NOW
	},
	occurrence_content:{		
		type:DataTypes.STRING,
		comment:'发生内容'
	}
  },{timestamps:false})
  const studentScores = sequelize.define('student_scores', {
	Id: {
	  type: DataTypes.INTEGER,
	  primaryKey: true,
	  autoIncrement: true,
	},
	student_id:{
		type:DataTypes.INTEGER,
		references:{
			model:'students',
			key:'Id'
		},
		comment:'学生id'
	},
	student_score:{
		type:DataTypes.DATE,
		comment:'学分',
	},
	score_time:{
		type:DataTypes.DATE,
		comment:'学分获取时间',
		defaultValue:DataTypes.NOW
	}
  },{timestamps:false})
  module.exports = {student,studentManifestation,studentScores}
  